Hi TK,
At the moment I have retrofitted 2 Maho milling machine's with success.(Last time I told you the machine stopped exact half way of an circle, when I did re installed windows xp the problem was fixed!
Now I did try to retrofit an weiler 120 turning machine. Most things work exact the same as with the milling machine.
But I don't really understand how to programmed the spindle speed.
I programmed the code below. (The spindle axis is programmed at axis 2 in the int.c as dac2 output and encoder input 3 A+/- B+/-)
If I type m3 s100 within mach3 turn the spindle start turning exact 100 rpm. But I don't receive any feed back of my actual spindle speed. So I can not use the 'calibrate spindle' within mach3 turn. And if I change F50 it start turning at 100%.
I programmed the mach3 plug-in to : sensor type 1, encoder axis 2, counts/rev 2000.
Any idea's?
With kind regards,
Frank
#include "KMotionDef.h"
//Plugin Notifications and defines..
enum { EX_DDA , EX_VMS, EX_COMMAND, EX_SPINON, EX_SPINOFF, EX_SPINSPEED, EX_MOTORTUNED
, EX_SETUP, EX_FEEDHOLD, EX_RUN, EX_ESTOP , EX_CONFIG };
main()
{
int message = persist.UserData[0]; // Mach3 message ID
int Direction = persist.UserData[1]; // Mach3 Spindle Direction
float speed = *(float *)&persist.UserData[2]; // value stored is actually a float
printf("Mach3 Notify Message=%d, Direction=%2d, Spindle Set to %f\n",message,Direction,speed);
switch (message)
{
case EX_SPINSPEED:
printf("Spindle Speed Set to %f\n",speed);
if (ReadBit(sp_cw)==1)
{
Jog(S,speed*FACTOR);
}
else if (ReadBit(sp_ccw)==1)
{
Jog(S,speed*FACTOR*-1);
}
break;
}
}
|